<input type="hidden" name="reply_id" value="{$reply['id']}" />
<div class="alert alert-block alert-new">
    <a class="close" data-dismiss="alert">×</a>
    <div class="panel panel-default">
        <div class="panel-heading">微暗号订单设置</div>
        <div class="panel-body">

            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">启用设置</label>
                <div class="col-sm-9 col-xs-12">
                    {if $reply['status']}
                    <a id="jinyong" href="{php echo create_url('index/module', array('do' => 'status', 'name' => 'wdl_anhao','rid' => $reply['rid'], 'status' => 0))}" onclick="return ajaxopen(this.href)" class="btn btn-primary module-button-switch">禁用</a>
                    {else}
                    <a id="qiyong" href="{php echo create_url('index/module', array('do' => 'status', 'name' => 'wdl_anhao','rid' => $reply['rid'], 'status' => 1))}" onclick="return ajaxopen(this.href);" class="btn btn-danger module-button-switch">启用</a>
                    {/if}
                </div>
            </div>        

            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">暗号标题</label>
                <div class="col-sm-9 col-xs-12">
                    <input type="text" class="form-control" name="title" value="{$reply['title']}">
                </div>
            </div>

            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">暗号活动时间</label>
                <div class="col-sm-9 col-xs-12">
                    <div class="col-sm-4 col-xs-6">{php echo tpl_form_field_date('start_time', !empty($item['start_time']) ? date('Y-m-d H:i',$item['start_time']) : date('Y-m-d H:i'), 1)}</div>
                    <div class="col-sm-4 col-xs-6">{php echo tpl_form_field_date('end_time', !empty($item['end_time']) ? date('Y-m-d H:i',$item['end_time']) : date('Y-m-d H:i'), 1)}</div>
                </div>
            </div>            

            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">消息图片</label>
                <div class="col-sm-9 col-xs-12">
                    {php echo tpl_form_field_image('picture'.$namesuffix, $reply['picture'], '', array('extras' => array('text' => 'readonly')))}
                </div>
            </div>             

            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">暗号简介</label>
                <div class="col-sm-9 col-xs-12">
                    <textarea style="height:200px; width:535px;" name="description" class="form-control richtext-clone" cols="70">{$reply['description']}</textarea>
                    <div class="help-block">用于图文显示的简介</div>
                </div>
            </div>              

            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">幻灯片1</label>
                <div class="col-sm-9 col-xs-12">
                    {php echo tpl_form_field_image('headimage'.$namesuffix, $reply['headimage'], '', array('extras' => array('text' => 'readonly')))}
                    <div class="help-block">大图片建议尺寸：640像素 * 320像素</div>

                </div>
            </div>  
			<div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">幻灯片地址1</label>
                <div class="col-sm-9 col-xs-12">
                    <input type="text" class="form-control" name="address" value="{$reply['address']}">					
                    <div class="help-block">例如http://www.zmn-wx.com</div>
                </div>
            </div> 
			
			<div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">幻灯片2</label>
                <div class="col-sm-9 col-xs-12">
                    {php echo tpl_form_field_image('headimage1'.$namesuffix, $reply['headimage1'], '', array('extras' => array('text' => 'readonly')))}
                    <div class="help-block">大图片建议尺寸：640像素 * 320像素</div>

                </div>
            </div> 
			<div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">幻灯片地址2</label>
                <div class="col-sm-9 col-xs-12">
                    <input type="text" class="form-control" name="address1" value="{$reply['address1']}">					
                    <div class="help-block">例如http://www.zmn-wx.com</div>
                </div>
            </div> 
			
			<div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">幻灯片3</label>
                <div class="col-sm-9 col-xs-12">
                    {php echo tpl_form_field_image('headimage2'.$namesuffix, $reply['headimage2'], '', array('extras' => array('text' => 'readonly')))}
                    <div class="help-block">大图片建议尺寸：640像素 * 320像素</div>

                </div>
            </div> 
			<div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">幻灯片地址3</label>
                <div class="col-sm-9 col-xs-12">
                    <input type="text" class="form-control" name="address2" value="{$reply['address2']}">					
                    <div class="help-block">例如http://www.zmn-wx.com</div>
                </div>
            </div> 
			
			<div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">额外号码个数</label>
                <div class="col-sm-9 col-xs-12">
                    <input type="text" class="form-control" name="max" value="{$reply['max']}">					
                    <div class="help-block">数值在1~4(否则会出现问题)</div>
                </div>
            </div> 
			
				
				
			<input type="hidden" name="tel" class="form-control" value="13237175933">			
            
        <!--    <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">暗号电话</label>
                <div class="col-sm-9 col-xs-12">
                    <input type="text" name="tel" class="form-control" value="{$reply['tel']}">
                    <div class="help-block">接收暗号的电话号码，如：0755-88889999。</div>
                </div>
            </div> -->     
        </div>
    </div>


    <div class="list">


        <table id="append-list" class="table table-bordered table-hover dataTable">
            <thead>
                <tr>
                    <th>奖项</th>
                    <th>人数</th>
                    <th>奖品</th>
                 <!--   <th>操作</th>-->
                </tr>
            </thead>
            <tbody id="orderbody">
                {if !empty($items)}
                {php $t=1;}
                {loop $items $item}				
                {php include $this->template('item');}
                {php $t++;}
                {/loop}		
                {else}

            <!--    <tr id="line1">
                    <td>
                        <select name="item-type-new[1]" class="form-control " readonly="readonly">
                            <option value="0"  selected="selected">单行文本</option>
                            <option value="1">多行文本</option>
                            <option value="2">日期列表</option>
                            <option value="3" >下拉选项</option>
                        </select>
                    </td>
                    <td>
                        <input name="item-fieldname-new[1]" type="text" class="form-control " value="联系人" readonly="readonly">
                    </td>
                    <td>
                        <input name="item-fieldcontent-new[1]" type="text" class="form-control wizard-ignore" value="请输入您的名字" readonly="readonly">
                    </td>

                    <td>
                        默认
                        <input type="hidden" value="1" name="item-isdefault-new[1]" />
                        <input type="hidden" value="1" name="item-orderid-new[1]" />
                    </td>
                </tr>
                <tr id="line2">
                    <td><select name="item-type-new[2]" class="form-control " readonly="readonly">
                            <option value="0"  selected="selected">单行文本</option>
                            <option value="1">多行文本</option>
                            <option value="2">日期列表</option>
                            <option value="3" >下拉选项</option>
                        </select>
                    </td>
                    <td>
                        <input name="item-fieldname-new[2]" type="text" class="form-control wizard-ignore" value="联系电话" readonly="readonly"></td>
                    <td>
                        <input name="item-fieldcontent-new[2]" type="text" class="form-control wizard-ignore" value="请输入您的电话" readonly="readonly"></td>

                    <td>默认<input type="hidden" value="1" name="item-isdefault-new[2]" /><input type="hidden" value="2" name="item-orderid-new[2]" /></td>
                </tr>-->
                <tr id="line3">
                    <td>
                        <select class="form-control " name="item-type-new[3]">
                            
                            <option value="1">一等奖</option>
                            
                        </select>
                    </td>
                    <td>
                        <input name="item-fieldname-new[3]" type="text" class="form-control wizard-ignore" value=""></td>
                    <td>
                        <input name="item-fieldcontent-new[3]" type="text" class="form-control wizard-ignore" value=""></td>

                <!--    <td><a href="javascript:;" onclick="deleteItem(3)">删除</a><input type="hidden" value="0" name="item-isdefault-new[3]" /><input type="hidden" value="3" name="item-orderid-new[3]" /></td>-->
                </tr>
                <tr id="line4">
                    <td><select class="form-control " name="item-type-new[4]" >
                            
                            <option value="2">二等奖</option>
                            
                        </select>
                    </td>
                    <td>
                        <input name="item-fieldname-new[4]" type="text" class="form-control wizard-ignore" value=""></td>
                    <td>
                        <input name="item-fieldcontent-new[4]" type="text" class="form-control wizard-ignore" value=""></td>

                </tr>											 
                <tr id="line5">
                    <td><select class="form-control " name="item-type-new[5]" >
                            
                            <option value="3" >三等奖</option>
                        </select>
                    </td>
                    <td>
                        <input name="item-fieldname-new[5]" class="form-control wizard-ignore" type="text" value="" ></td>
                    <td>
                        <input name="item-fieldcontent-new[5]" class="form-control wizard-ignore" type="text" value="" ></td>

                </tr>
                {php $t=6;}
                {/if}
            </tbody>
        </table>
    </div>
  <!--  <div class="reply-news-edit-button"><a href="javascript:void(0)" id="newline" class="btn"><i class="icon-plus"></i> 添加新字段</a></div>-->
</div>
<script type="text/javascript">
    $('#qiyong, #jinyong').click(function () {
        setTimeout("history.go(0)", 500);
    });
    require(['jquery', 'util'], function ($, u) {
        $(function () {
            u.editor($('.richtext-clone')[0]);
        });
    });

    function deleteItem(index) {
        $("#line" + index).remove();
        }
        var cindex = {$t};
        $("#newline").bind("click", function () {

            var html = '<tr id="line' + cindex + '">';
            html += '<td><select name="item-type-new[' + cindex + ']" class="form-control"><option value="0">单行文本</option><option value="1">多行文本</option><option value="2">日期列表</option><option value="3">下拉选项</option><select></td>';
            html += '<td><input type="text"  value="" class="form-control" name="item-fieldname-new[' + cindex + ']"></td>';
            html += '<td><input type="text" value="" class="form-control" name="item-fieldcontent-new[' + cindex + ']"></td>';
            html += '<td><p><a href="javascript:;" onclick="deleteItem(' + cindex + ')">删除</a></p><input type="hidden" value="0" name="item-isdefault-new[' + cindex + ']" /><input type="hidden" value="' + cindex + '" name="item-orderid-new[' + cindex + ']" /></td>';
            html += '</tr>';
            $("#orderbody").find("tr:last").before(html);

            cindex++;
        });


        function add_row() {
        $.getJSON('{php echo create_url('index / module / formdisplay', array('name' => 'wdl_anhao'))}', function(data){
        if (data.error === 0 && data.content.html != '') {
            $('#append-list').append(data.content.html);
            row = $('#' + data.content.id);
        }
        }
        );
    }
//字段类型切换
    $("#append-list").delegate("#award-inkind input", "click", function () {
        if ($(this).val() == 0) {
            $(this).parents(".item").find(".num").css("display", "none");
            $(this).parents(".item").find("tr:eq(3),tr:eq(4)").show();
        } else {
            $(this).parents(".item").find(".num").css("display", "inline-block");
            $(this).parents(".item").find("tr:eq(3),tr:eq(4)").hide();
        }
    });
</script>